#define _CRT_SECURE_NO_WARNINGS 1

#include"stdio.h"
int main()
{
    int goldcoin = 0;
    int K = 0;
    scanf("%d", &K);
    int sum = 0;
    int count = 0;
    for (int i = 1; sum + i < K; i++)
    {
        sum += i;
        count++;
    }
    goldcoin = count * (count + 1) * (2 * count + 1) / 6;
    int left = K - sum;
    goldcoin += left * (count + 1);
    printf("%d\n", goldcoin);

    return 0;
}